//实现元素移动
function movePosition(elementId,finalX,finalY,interval){
    let elem = document.getElementById(elementId)
    if(Element.moveEvent){
        clearTimeout(elem.moveEvent)       //清除计时器
    }
    let xpot = parseInt(elem.style.left)        //使用parseInt后为NaN
    let ypot = parseInt(elem.style.top)
    if(xpot == finalX && ypot == finalY){
        return true
    }
    if(xpot<finalX){
        xpot++
    }
    if(xpot>finalX){
        xpot--
    }
    if(ypot<finalY){
        ypot++
    }
    if(ypot>finalY){
        ypot--
    }
    elem.style.left = xpot + 'px'
    elem.style.top = ypot + 'px'
    let repeat = "movePosition('"+elementId+"',"+finalX+","+finalY+","+interval+")"
    elem.moveEvent = setTimeout(repeat,interval)    //调用函数时使用引号？
}